
	<div id="graph<?php echo $reportdef['id']?>" style="text-align: center"></div>
	<script type="text/javascript">
	function refresh<?php echo $reportdef['id']?>(){
		
		//I send all imputs to send also the search values! 
		var $inputs = $(':input');
		var query = '<?php print url_for('reports/getData?id='.$reportdef['id']); ?>'; 
		var first = true;
	    for(var i= 0; i < $inputs.length; i++)
	    {
	        if(first){
	            var symbol = '?';
	        }else{
	        	var symbol = '&';
	        }
	        first = false;
	        if($inputs[i].name!=''){
	        	switch ($inputs[i].type) {
	        		case "checkbox":
		            var inputValue = $inputs[i].checked;
		        break;
	        		case "select-multiple":
		    		options = new Array();
		    		for(var j= 0; j < $inputs[i].options.length; j++){
						if($inputs[i].options[j].selected){
							options.push($inputs[i].options[j].value);
						}
		    		}
		    		var inputValue = array2json(options);
	        	break;
	        		default: 
				    var inputValue = $inputs[i].value;
			    }
		        
	    		query = query+symbol+$inputs[i].name+'='+inputValue;
	        }
	    };
		
		var elemIF = document.createElement("iframe");
		elemIF.src = query; 
		elemIF.id = 'upload_target'; 
		elemIF.style.display = "none"; 
		document.body.appendChild(elemIF);
	
	}
	
		function refreshOLD<?php echo $reportdef['id']?>(){
			document.getElementById('graph<?php echo $reportdef['id']?>').innerHTML = "<div \"style: text-align:center;\"><img style=\"width:66px;height:66px;\" alt=\"<?php echo __('wait please...'); ?>\" src=\"/images/ajax-loader-large.gif\"></div>";
			var $inputs = $(':input');
			var query = ''; 
			var first = true;
		    for(var i= 0; i < $inputs.length; i++)
		    {

		    	thisInput = $inputs[i];
		    	if($inputs[i].type == 'checkbox'){
		    		valueToSend = $inputs[i].checked;
		    	}else if($inputs[i].type == 'select-multiple'){
		    		options = new Array();
		    		for(var j= 0; j < $inputs[i].options.length; j++){
						if($inputs[i].options[j].selected){
							options.push($inputs[i].options[j].value);
						}
		    		}
		    		valueToSend = array2json(options);
		    	}else{
		    		valueToSend = $inputs[i].value;
		    	}
		        if(first){
		            var symbol = '';
		        }else{
		        	var symbol = '&';
		        }
		        first = false;
		        if($inputs[i].name!=''){
		    		query = query+symbol+$inputs[i].name+'='+valueToSend;
		        }
		    };
			
			xhrChart = getXmlHttpRequest2();
			xhrChart.onreadystatechange = function(){
				if(xhrChart.readyState == 4 && xhrChart.status == 200)
					{
					var chartData = xhrChart.responseText;
					document.getElementById('graph<?php echo $reportdef['id']?>').innerHTML = chartData;
				}
			};
			xhrChart.open("POST","<?php print url_for('reports/exportData'); ?>",true);
			xhrChart.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			xhrChart.send("id="+<?php echo $reportdef['id'];?>+ "&format=download&"+query);	
		}
	</script>